home *** CD-ROM | disk | FTP | other *** search
- unit Unit1;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, CheckLst, ExtCtrls;
-
- type
- TForm1 = class(TForm)
- Image1: TImage;
- rgPackage: TRadioGroup;
- clbOptions: TCheckListBox;
- Label1: TLabel;
- btnCalculate: TButton;
- edtCost: TEdit;
- Label2: TLabel;
- procedure btnCalculateClick(Sender: TObject);
- procedure rgPackageClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- (* ************************************************************************** *)
-
- var
- Form1: TForm1;
-
- implementation
-
- uses TDMWebLib_TLB, ComObj;
-
- {$R *.DFM}
-
- procedure TForm1.btnCalculateClick(Sender: TObject);
- var obj : _Package;
- cost : double;
- i,options : integer;
- begin
- // Create an instance of the C# TDMWebLib object...
- obj := CoPackage.Create;
-
- options:=0;
-
- // figure out which options are set...
- for i:=0 to clbOptions.Items.Count - 1 do
- if clbOptions.checked[i] then
- options := (1 SHL i) + options;
-
- // Simple validation, and we're off...
- if (options > 0) then
- case rgPackage.ItemIndex of
- 0: cost := obj.Basic(options);
- 1: cost := obj.Advanced(options);
- 2: cost := obj.Professional(options);
- else ShowMessage('You must select a Package!');
- end
- else
- ShowMessage('You must select at least one option!');
-
- edtCost.text:=Format('%m',[cost]);
- end;
-
- (* ************************************************************************** *)
-
- procedure TForm1.rgPackageClick(Sender: TObject);
- var i : integer;
- begin
- edtCost.Text:='';
-
- // Clear the currently selected options...
- for i:=0 to clbOptions.items.count - 1 do clbOptions.Checked[i]:=false;
-
- // 50MB is only available for the Professional Package...
- clbOptions.ItemEnabled[2]:=(Sender as TRadioGroup).ItemIndex = 2;
- end;
-
- end.
-